package com.software.levelupserver.controller;

import com.software.levelupserver.entity.Grade;
import com.software.levelupserver.service.GradeService;
import com.software.levelupserver.utils.ResultVOUtil;
import com.software.levelupserver.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/grade")
public class GradeController {

    @Resource
    private GradeService gradeService;

    @GetMapping("/getAllGrade")
    public Result getAllGrade(){
        List<Grade> allGrade = gradeService.getAllGrade();

        if (allGrade != null){
            return ResultVOUtil.success(allGrade);
        }else {
            return ResultVOUtil.error("获取数据失败");
        }
    }
}
